package com.test;

import sun.nio.cs.ext.MacHebrew;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
 * 测试stream会不会乱序
 */
public class StreamTest2 {
	public static void main(String[] args) {
		List list = new ArrayList<Integer>();
		list.add(1);
		list.add(2);
		list.add(3);
		List<Integer> newList = (List<Integer>) list.stream().filter(new Predicate() {
			@Override
			public boolean test(Object o) {
				return (Integer) o % 2 != 0;
			}
		}).collect(Collectors.toList());

		System.out.println(newList);
	}
}
